<template>
  <elm-page-tb>
    <template #top>
      <el-input placeholder="请查询输入内容" prefix-icon='el-icon-search' size="mini" style="width: 250px;"
                v-model="postData.contract_name" clearable></el-input>
      <right>
        <el-button-group>
          <el-button icon="el-icon-search" size="mini" @click="tablebinding()">查询</el-button>
          <elm-open-button url="contracts_zc_edit" icon="el-icon-edit" title="新增" width="60%" height="80%">新增
          </elm-open-button>
        </el-button-group>
      </right>
    </template>
    <elm-table url="/business/cmis/contracts_zc/GetData" :post-data="postData" :show-index="true" height="100%">
      <el-table-column v-if="false" prop="sys_code_key" label="合同编号" align="center" width="200">
      </el-table-column>
      <el-table-column prop="r_code" label="签订编号" align="center" width="150">
      </el-table-column>
      <el-table-column prop="contract_name" label="合同名称" align="center">
      </el-table-column>
      <el-table-column prop="contract_type" label="合同类型" align="center" width="100">
      </el-table-column>
      <el-table-column prop="contract_date" label="签订日期" align="center" width="100">
      </el-table-column>
      <el-table-column label="合同期限" align="center" width="200">
        <template v-slot="scope">
          <span>{{scope.row.start_date}}至{{scope.row.end_date}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="amount" label="合同金额(万元)" align="center" width="120">
      </el-table-column>
      <el-table-column prop="status" label="合同状态" align="center" width="100">
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="120px" align="center" style="position:absolute">
        <template v-slot="scope">
          <elm-open-button url="contracts_settle" title="编辑" width="60%" height="80%" :data="{ code: scope.row.sys_code_key, type: 'out' }"
                           type="text">结算
          </elm-open-button>
          <elm-open-button url="contracts_zc_edit" title="编辑" width="60%" height="80%" :data="{ model: scope.row }"
                           type="text">编辑
          </elm-open-button>
          <el-button type="text" size="mini" @click="deleteData(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </elm-table>
  </elm-page-tb>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      postData: {contract_name: null}
    }
  },
  async created() {
  },
  methods: {
    async deleteData(data) {
      await this.delete('/business/cmis/contracts_zc/Delete', {id: data.id});
      this.tablebinding();
    }
  }
}
</script>

<style scoped>
</style>